package com.dongqi.myblog.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dongqi.myblog.po.TBlog;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dongqi.myblog.po.TTag;
import com.dongqi.myblog.po.TType;
import com.dongqi.myblog.po.TUser;
import com.dongqi.myblog.po.vo.BlogQuery;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author dongqi
 * @since 2020-08-03
 */
public interface TBlogService extends IService<TBlog> {

    Page<BlogQuery> listBlogs(TBlog blog, Page<BlogQuery> page);

    TBlog getBlogById(Long id);

    TBlog updateBlogById(TBlog blog);

    int insertBlog(BlogQuery blog, TUser user,MultipartFile file);

    boolean deleteBlog(Long id);

    Page<BlogQuery> listIndex(TBlog blog, Page<BlogQuery> page);

    Page<BlogQuery> listType(Long id, Page<BlogQuery> page);

    Page<BlogQuery> listSearch(String query,Page<BlogQuery> page);

    TBlog selectBlog(Long id);

    /**
     * 获取并转换成markdown
     * @param id
     * @return
     */
    TBlog getAndConvert(Long id);

    Boolean updateViews(TBlog blog);

    Page<TBlog> blogsByTag(Page<TBlog> page,Long tagId);

    Map<String,List<TBlog>> archiveBlog();

    Long countBlog();
}
